<template>
    <view class="x-tabbar-placeholder pb-safe-area">
        <view class="x-tabbar pb-safe-area">
            <view class="x-tabbar-item" v-for="(item,index) in GLOBALSTATUS.tabbar" :key="index"
            :class="{'x-tabbar-item-active':props.page&&item.url.includes(props.page)}"
            @tap="$page.ads(item)">
                <image :src="props.page&&item.url.includes(props.page)?(item.image_2||item.image):item.image" class="x-tabbar-item-icon"/>
                <text class="x-tabbar-item-text">{{item.title}}</text>
            </view>
        </view>
    </view>
</template>
<script lang="ts" setup>
import { defineProps } from 'vue';
import { $page } from '@/utils';
import { useStatusStore,useRefs } from "@/stores";
const props = withDefaults(defineProps<{
	page?: string,
}>(), {
});
const statusStore=useStatusStore();
const {GLOBALSTATUS}=useRefs(statusStore);
</script>
<style lang="scss" scoped>
.x-tabbar-placeholder,
.x-tabbar{
    height: 50px;
    box-sizing: unset;
}
.x-tabbar{
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--xl-white);
    display: flex;
    justify-content: space-around;
    align-items: center;
    &-item{
        --text-color: var(--xl-dark-light-5);
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        &-icon{
            width: 30px;
            height: 30px;
        }
        &-text{
            font-size: 12px;
            color: var(--text-color);
        }
        &-active{
            --text-color: var(--xl-primary);
        }
    }
}
</style>